Skip to content

加密模型包到文件 - YoloEncryptModel

函数简介

将明文模型与可选类别名表打成欧拉加密包并写入磁盘;包头写入 modelType、inferenceType。

接口名称

YoloEncryptModel

DLL 调用

int YoloEncryptModel(long ola, string modelPath, string ncnnParamPath, string namesLabel, string password, int modelType, int inferenceType, string savePath);

参数说明

参数名类型说明
ola长整数型OLAPlug 对象指针,由 CreateCOLAPlugInterFace 生成。
modelPath字符串主模型路径
ncnnParamPath字符串NCNN .param,可空
namesLabel字符串类别名文件,可空
password字符串加密密码
modelType整数型模型类型
inferenceType整数型推理类型
savePath字符串输出加密包路径

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
// 模型加解密通常用于发布/部署流程
int ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");
csharp
using OLAPlug;

var ola = new OLAPlugServer();
// 模型加解密通常用于发布/部署流程
int ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
# 模型加解密通常用于发布/部署流程
ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
// 模型加解密通常用于发布/部署流程
int ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");
cpp
var ola = com("OlaPlug.OlaSoft")
// 模型加解密通常用于发布/部署流程
var ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
' 模型加解密通常用于发布/部署流程
ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")
text
.局部变量 ola, OLAPlug
ola.创建 ()
' 模型加解密通常用于发布/部署流程
ret = ola.YoloEncryptModel(“models/raw.onnx“, “models/raw.param“, “labels.txt“, “pwd“, 0, 0, “models/out.olam“)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
// 模型加解密通常用于发布/部署流程
var ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
// 模型加解密通常用于发布/部署流程
整数 ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
// 模型加解密通常用于发布/部署流程
int ret = ola.YoloEncryptModel("models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");

原生 DLL 调用

cpp
long instance = CreateCOLAPlugInterFace();
YoloEncryptModel(instance, "models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");
csharp
long instance = CreateCOLAPlugInterFace();
YoloEncryptModel(instance, "models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam");
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
YoloEncryptModel(instance, "models/raw.onnx", "models/raw.param", "labels.txt", "pwd", 0, 0, "models/out.olam")

返回值

整数型:1 成功,0 失败。

注意事项

  • 需要插件已开通 YOLO 模块权限(Reg、Login的FeatureList中包含YOLO特性)。
含义
0TensorRT Engine(.engine)
1ONNX(.onnx)
2NCNN(.bin + .param 双文件)
含义
0Detect 目标检测
1Classify 图像分类
2Segment 实例分割
3Pose 姿态估计
4Obb 旋转框检测